import * as vscode from 'vscode';

export class SettingsManager {
    private static readonly DRAFT_COLOR_KEY = 'md2wx.draftColor';

    constructor() {
        this.watchConfigChanges();
    }

    private watchConfigChanges(): void {
        vscode.workspace.onDidChangeConfiguration((e: vscode.ConfigurationChangeEvent) => {
            if (e.affectsConfiguration(SettingsManager.DRAFT_COLOR_KEY)) {
                this.getDraftColor(); // 更新缓存
            }
        });
    }

    public getDraftColor(): string {
        const config = vscode.workspace.getConfiguration();
        return config.get<string>(SettingsManager.DRAFT_COLOR_KEY, '#0000ff');
    }
}